<html>
<head><meta charset="utf-8"><title>2020-01-09 meeting · t-compiler/wg-parallel-rustc · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/index.html">t-compiler/wg-parallel-rustc</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html">2020-01-09 meeting</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="185232744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185232744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185232744">(Jan 09 2020 at 17:04)</a>:</h4>
<p>Action items from today:</p>



<a name="185232767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185232767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185232767">(Jan 09 2020 at 17:04)</a>:</h4>
<ul>
<li>alex and others will work on filling out <a href="https://hackmd.io/rZZtwhJMTHm_Ivszf6uWmg?both" target="_blank" title="https://hackmd.io/rZZtwhJMTHm_Ivszf6uWmg?both">https://hackmd.io/rZZtwhJMTHm_Ivszf6uWmg?both</a></li>
</ul>



<a name="185232883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185232883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185232883">(Jan 09 2020 at 17:05)</a>:</h4>
<p>have you recorded the meeting?</p>



<a name="185232995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185232995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185232995">(Jan 09 2020 at 17:06)</a>:</h4>
<ul>
<li><span class="user-mention" data-user-id="116122">@simulacrum</span> will work on making the cargo jobserver changes behind a flag</li>
</ul>



<a name="185232999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185232999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185232999">(Jan 09 2020 at 17:06)</a>:</h4>
<ul>
<li>@cuviper will look into rayon and see if our lazy spawn strategy might cause any issues with internals</li>
</ul>



<a name="185233045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185233045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185233045">(Jan 09 2020 at 17:07)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> oh rats we forgot to record :(</p>



<a name="185234661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185234661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185234661">(Jan 09 2020 at 17:24)</a>:</h4>
<p>no worries, should have asked for that before</p>



<a name="185268094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185268094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185268094">(Jan 09 2020 at 23:30)</a>:</h4>
<p>RE the effect of a custom lazy spawns, I found only a few ways that rayon would actually notice that threads are missing:</p>
<ol>
<li>if you don't actually spawn _any_ threads, then calls into the threadpool will block forever</li>
<li><code>Registry::wait_until_primed</code> will block until all threads have checked in from their main loop. This is only called from <code>ThreadPoolBuilder::build_global</code>, which doesn't affect rustc, and frankly I don't think we really need it anyway. The loose justification is just to help warm up for benchmarking purposes.</li>
<li>
<p><code>Registry::wait_until_stopped</code> will block until all threads have indicated that they've exited their main loop. This is <code>#[cfg(test)]</code> only on vanilla rayon, but rustc-rayon calls this at the end of <code>ThreadPoolBuilder::build_scoped</code> to make sure they all call the release handler before we exit.<br>
    - if rustc uses a fully custom spawn handler instead, then <code>ThreadPoolBuilder::build</code>, it could handle that differently too</p>
</li>
<li>
<p>rustc-rayon's deadlock detection will count all threads as "active" by default, so those lazy threads will keep the <code>deadlock_check</code> from ever triggering.</p>
</li>
</ol>



<a name="185615443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185615443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185615443">(Jan 14 2020 at 16:58)</a>:</h4>
<p><span class="user-mention" data-user-id="138448">@cuviper</span> to clarify, is the conclusion that if we unconditionally spawn one rayon thread then we should be able to slowly spawn the others?</p>



<a name="185615958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185615958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185615958">(Jan 14 2020 at 17:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> point 3 means you'd have to spawn all the threads eventually. you might be able to fake that by running them directly during the threadpool shutdown, if you can find the right time to do that.<br>
for point 4, I don't know if anything is actually depending on that being effective? if so, I think that's a problem, and if not, maybe it should be removed</p>



<a name="185616098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185616098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185616098">(Jan 14 2020 at 17:04)</a>:</h4>
<p>hm ok, if we're forced to do it anyway then that may be a bit of a bummer, but this may just be part of rustc-rayon reviews/etc</p>



<a name="185617492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185617492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185617492">(Jan 14 2020 at 17:18)</a>:</h4>
<p>both of those are specific to rustc-rayon extensions. maybe they can be tweaked to help in this regard</p>



<a name="185640630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185640630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185640630">(Jan 14 2020 at 21:10)</a>:</h4>
<p>Ok to follow up on some of the investigation from the internals thread as well, I fille din some more results here -- <a href="https://hackmd.io/rZZtwhJMTHm_Ivszf6uWmg?both" target="_blank" title="https://hackmd.io/rZZtwhJMTHm_Ivszf6uWmg?both">https://hackmd.io/rZZtwhJMTHm_Ivszf6uWmg?both</a></p>



<a name="185640670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185640670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185640670">(Jan 14 2020 at 21:10)</a>:</h4>
<p>in general I wasn't really able to reproduce anything, sort of as expected, but I did develop a few theories for why the regressions were so drastic</p>



<a name="185640707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185640707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185640707">(Jan 14 2020 at 21:11)</a>:</h4>
<p>the primary one is that the jobserver management bug in rustc which allows many rustc's to get spawned could blow memory limits easily, triggering swap, causing a big slowdown</p>



<a name="185640737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185640737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185640737">(Jan 14 2020 at 21:11)</a>:</h4>
<p>another one though is that when the parallel compiler is single threaded it's slower than it is today (as we already know) and if you're build is already extremely parallel (as some of them were) then you're getting very little benefit, this is the "dynamically avoiding atomics" topic in zulip right now</p>



<a name="185640802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185640802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185640802">(Jan 14 2020 at 21:12)</a>:</h4>
<p>Overall I don't see anything glaring or too too worrisome, I think we need to keep on fixing bugs though of course</p>



<a name="185641224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09%20meeting/near/185641224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/2020-01-09.20meeting.html#185641224">(Jan 14 2020 at 21:17)</a>:</h4>
<p>I plan to get my work item done tonight</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>